using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using NLarge.Properties;

namespace NLarge
{
    /// <summary>
    /// Interaction logic for AboutNLarge.xaml
    /// Rob Burke
    /// robburke@microsoft.com
    /// Released under MS-PL (Microsoft permissive license):  http://www.microsoft.com/resources/sharedsource/licensingbasics/permissivelicense.mspx 
    /// Copyright (c) Microsoft Corporation.  All rights reserved.
    /// </summary>
    public partial class AboutNLarge : System.Windows.Window
    {

        private AboutNLarge()
        {
            InitializeComponent();
        }

        private void OnFormLoaded(object sender, RoutedEventArgs e)        
        {
            this.Topmost = true;
        }

        private void OpenBlog(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process.Start(@"http://www.codeplex.com/NLarge/");
        }
        private void ZoomDepthToDefault(object sender, RoutedEventArgs e)
        {
            Settings.Default.ZoomDepth = 2;
        }
        private void ZoomSpeedToDefault(object sender, RoutedEventArgs e)
        {
            Settings.Default.ZoomSpeed = 0.65;
        }
        private void BreakTimerOpacityToDefault(object sender, RoutedEventArgs e)
        {
            Settings.Default.BreakTimerOpacity = 0.6;
        }
        private void BreakTimeSpanToDefault(object sender, RoutedEventArgs e)
        {
            Settings.Default.BreakTimeSpan = TimeSpan.FromMinutes(10);
        }

        private void PenWidthToDefault(object sender, RoutedEventArgs e)
        {
            Settings.Default.PenWidth = 3;
        }

        private void CloseAboutWindow(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void OnClosed(object sender, EventArgs e)
        {
            Instance = null;
            Settings.Default.Save();
        }

        public static void PresentAboutDialog()
        {
            if (Instance != null)
            {
                Instance.Close();
            }
            Instance = new AboutNLarge();
            Instance.Show();
        }

        public static bool IsDialogVisible
        {
            get
            {
                return Instance != null && (Instance.IsVisible);
            }
        }

        public static void KillAboutDialog()
        {
            if (Instance != null) Instance.Close();
            Instance = null;
        }

        private static AboutNLarge Instance = null;

 

    }
}